Enterprises often store their data in databases. For example, an enterprise may store information describing employees, customers, products, financial transactions, and the like in databases. These databases provide functionality for managing data including updates to the data as well as querying the data. Databases typically support standard interfaces that allow an end user to access the data. Most databases support the structured query language (SQL) for manipulating and accessing data.
The database query languages allow users to functionally express the desired result. These database query languages typically hide the details of how the database system processes the data to compute the results of the query. Database systems attempt to optimize the statements provided by the users to efficiently execute the query. However, users often provide complex database queries that the database system is unable to optimize effectively. If the database system is unable to effectively optimize a query, the queries can perform very inefficiently. As a result, the applications relying on these queries also perform poorly.